#include "RobotTurnCommand.h"

RobotTurnCommand::RobotTurnCommand(Robot* receiver, const Direction& direction): robot(receiver), turnDirection(direction)
{
}

RobotTurnCommand::RobotTurnCommand(const RobotTurnCommand& rhs): GameCommand(rhs), robot(rhs.robot), turnDirection(rhs.turnDirection)
{
}

RobotTurnCommand::~RobotTurnCommand()
{
}

void RobotTurnCommand::Execute()
{
	if (robot)
	{
		switch(turnDirection.Type())
		{
			case Direction::WEST:
				robot->TurnLeft();
			break;
			case Direction::EAST:
				robot->TurnRight();
			break;
		}
	}
}

GameCommand* RobotTurnCommand::Clone() const
{
	return new RobotTurnCommand(*this);
}
